import CURDHelper from '@/utils/CURDHelper'
import { VxeUI } from 'vxe-pc-ui';
import PageConfig from '@/utils/pageConfig'
import Query from '@/components/Query'
import XEUtils from 'xe-utils'
import { getBtnCtr } from '@/utils/BtnControl'

export default {
  name: 'ReportWorktime',
  components: {
    Query
  },
  data() {     
    return {
      baseApiUrl: '/api/Report',
      componentSize: PageConfig.ComponentSize,
      duration: PageConfig.Duration,
      QueryConditions: [],
      btnPromission: undefined,
      editModal:false,
      QueryConfig: [{
        title: '姓名',
        field: 'shy',
        type: 'input',
        value: '',
        placeholder: '请输入客户名称以查询',
      }, {
        title: '审核月份',
        field: 'auditmonth',
        type: 'datemonth',
        value:new Date(),
        placeholder: '请选择审核月份',
      }],
      GridOptions: {
        id: 'ReportWorktime_MainGrid',
        border: true,
        stripe: true,
        loading: false,
        size: PageConfig.ComponentSize,
        height: 700,
        columnConfig: {
          resizable: true
        },
        rowConfig: {
          isHover: true,
          isCurrent: true
        },
        checkboxConfig: {
          highlight: true,
          range: true
        },
        columns: [
          { type: 'seq', width: 50 },
          { field: 'xm', title: '姓名',  minWidth: 60, showOverflow: true },
          { field: 'zrt', title: '总人天',  minWidth: 70, showOverflow: true },          
          { field: 'day1', title: '1日',  minWidth: 45, showOverflow: true },
          { field: 'day2', title: '2日',  minWidth: 45, showOverflow: true },
          { field: 'day3', title: '3日',  minWidth: 45, showOverflow: true },
          { field: 'day4', title: '4日',  minWidth: 45, showOverflow: true },
          { field: 'day5', title: '5日',  minWidth: 45, showOverflow: true },
          { field: 'day6', title: '6日',  minWidth: 45, showOverflow: true },
          { field: 'day7', title: '7日',  minWidth: 45, showOverflow: true },
          { field: 'day8', title: '8日',  minWidth: 45, showOverflow: true },
          { field: 'day9', title: '9日',  minWidth: 45, showOverflow: true },
          { field: 'day10', title: '10日',  minWidth: 45, showOverflow: true },
          { field: 'day11', title: '11日',  minWidth: 45, showOverflow: true },
          { field: 'day12', title: '12日',  minWidth: 45, showOverflow: true },
          { field: 'day13', title: '13日',  minWidth: 45, showOverflow: true },
          { field: 'day14', title: '14日',  minWidth: 45, showOverflow: true },
          { field: 'day15', title: '15日',  minWidth: 45, showOverflow: true },
          { field: 'day16', title: '16日',  minWidth: 45, showOverflow: true },
          { field: 'day17', title: '17日',  minWidth: 45, showOverflow: true },
          { field: 'day18', title: '18日',  minWidth: 45, showOverflow: true },
          { field: 'day19', title: '19日',  minWidth: 45, showOverflow: true },
          { field: 'day20', title: '20日',  minWidth: 45, showOverflow: true },
          { field: 'day21', title: '21日',  minWidth: 45, showOverflow: true },
          { field: 'day22', title: '22日',  minWidth: 45, showOverflow: true },
          { field: 'day23', title: '23日',  minWidth: 45, showOverflow: true },
          { field: 'day24', title: '24日',  minWidth: 45, showOverflow: true },
          { field: 'day25', title: '25日',  minWidth: 45, showOverflow: true },
          { field: 'day26', title: '26日',  minWidth: 45, showOverflow: true },
          { field: 'day27', title: '27日',  minWidth: 45, showOverflow: true },
          { field: 'day28', title: '28日',  minWidth: 45, showOverflow: true },
          { field: 'day29', title: '29日',  minWidth: 45, showOverflow: true },
          { field: 'day30', title: '30日',  minWidth: 45, showOverflow: true },
          { field: 'day31', title: '31日',  minWidth: 45, showOverflow: true },
          
        ],
        data: []
      },     
    }
  },
  created() {
    this.btnPromission = getBtnCtr(
          this.$route.path,
          this.$store.getters.userPermission
        )
  },
  methods: {
    handleQuery(e) {
      this.QueryConditions = e;
      this.DoQuery(e);
    },    
    DoQuery(e) {
      let request = {
        isPaging: false,
        pageSize: 1,
        pageIndex: 1,
        queryConditions: e,
        orderByConditions: []
      }
      CURDHelper.Query(request, `${this.baseApiUrl}/GetWorktimeReport`)
        .then(res => {
          this.GridOptions.data = res.data;
        }).catch(err => {
          VxeUI.modal.message({
            content: err,
            status: 'error',
            duration: this.duration
          })
        })
    },    
  }
}
